package com.zyylr.classroomreservationsystem.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.zyylr.classroomreservationsystem.R;
import com.zyylr.classroomreservationsystem.activity.AddUserActivity;

/**
 * A simple {@link Fragment} subclass.
 * Activities that contain this fragment must implement the
 * {@link UserInformationFragment.OnFragmentInteractionListener} interface
 * to handle interaction events.
 * Use the {@link UserInformationFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class UserInformationFragment extends Fragment {
    private TextView add_user;
    private TextView delete_user;


    public UserInformationFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_user_information, container, false);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        add_user = getActivity().findViewById(R.id.add_user);          //点击添加用户所要完成的事件
        add_user.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getActivity(), "此处进行用户的添加", Toast.LENGTH_SHORT).show();
                startActivity(new Intent(getActivity(), AddUserActivity.class));
            }
        });

        delete_user = getActivity().findViewById(R.id.delete_user);     //点击删除用户所要完成的事件
        delete_user.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getActivity(), "此处进行用户的删除", Toast.LENGTH_SHORT).show();
            }
        });

    }
}
